package com.teradyne.merlin2.ui.server.models;

import java.io.Serializable;
import java.util.ArrayList;

public class Requests implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2067298564833545417L;

	private ArrayList<OrderRequest> listOrderRequest = new ArrayList<OrderRequest>();

	private ArrayList<RequestStatus> listRequestStatus = new ArrayList<RequestStatus>();

	public Requests() {
	}

	public ArrayList<OrderRequest> getListOrderRequest() {
		return listOrderRequest;
	}

	public void setListOrderRequest(ArrayList<OrderRequest> listOrderRequest) {
		this.listOrderRequest = listOrderRequest;
	}

	public ArrayList<RequestStatus> getListRequestStatus() {
		return listRequestStatus;
	}

	public void setListRequestStatus(ArrayList<RequestStatus> listRequestStatus) {
		this.listRequestStatus = listRequestStatus;
	}

//	public void copy(com.teradyne.merlin2.business.service.webservice.OrderRequest[] businessListOrderRequest) {
//		for (com.teradyne.merlin2.business.service.webservice.OrderRequest businessOrderRequest : businessListOrderRequest) {
//			OrderRequest orderRequest = new OrderRequest();
//			orderRequest.copy(businessOrderRequest);
//
//			listOrderRequest.add(orderRequest);
//		}
//	}

	public void extractRequestStatus() {
		for (OrderRequest orderRequest : listOrderRequest) {
			for (OrderHeader orderHeader : orderRequest.getOrderHeaders()) {
				for (OrderLine orderLine : orderHeader.getOrderLines()) {
					RequestStatus requestStatus = new RequestStatus();
					requestStatus.extractRequestStatus(orderRequest, orderHeader, orderLine);
					getListRequestStatus().add(requestStatus);
				}
			}

		}
	}

}
